import rospy
from turtlesim.srv import *
rospy.init_node("tospawn")
client=rospy.ServiceProxy("/spawn",Spawn)
request=SpawnRequest()
request.x=5
request.y=4
request.theta=50
request.name="dfg"
#client.wait_for_service()
rospy.wait_for_service("spawn")

try:
    response=client.call(request)
    rospy.loginfo("乌龟的名字%s",response.name)
except:
    rospy.loginfo("异常")